# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=kodi-game-libretro-beetle-pce-fast
pkgver=1.31.0.43
_realname=Nexus
pkgrel=0
pkgdesc="Beetle-PCE-fast for Kodi"
options="!check" # no test suite
url="https://github.com/kodi-game/game.libretro.beetle-pce-fast"
arch="x86_64 aarch64 armv7" # kodi is available only on these architectures
license="GPL-2.0-only"
makedepends="cmake kodi-dev samurai"
depends="kodi-game-libretro libretro-beetle-pce-fast"
source="$pkgname-$pkgver-$_realname.tar.gz::https://github.com/kodi-game/game.libretro.beetle-pce-fast/archive/$pkgver-$_realname.tar.gz"
builddir="$srcdir/game.libretro.beetle-pce-fast-$pkgver-$_realname"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake/kodi
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	rm -r "$pkgdir"/usr/share/kodi/addons/game.libretro.beetle-pce-fast/resources/icon.png \
		"$pkgdir"/usr/share/kodi/addons/game.libretro.beetle-pce-fast/resources/screenshot* \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.beetle-pce-fast/game.libretro.beetle-pce-fast.so
	ln -s /usr/lib/libretro/mednafen_pce_fast_libretro.so \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.beetle-pce-fast/game.libretro.beetle-pce-fast.so
	sed -i '/<assets>/,/<\/assets>/d' "$pkgdir"/usr/share/kodi/addons/game.libretro.beetle-pce-fast/addon.xml
}

sha512sums="
449f1e05ebff42ed5c82bb7369356805029c2d742ea6d66bbeda48b901a464a2a4cc6f3e64d9797b0fa8f31ade80916ebaf30ac3cdf9e61b34c8e79b364dfd60  kodi-game-libretro-beetle-pce-fast-1.31.0.43-Nexus.tar.gz
"
